#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int titleToNumber(char* s) {
    if (s == NULL) return 0;
    int res = 0;
    int count = strlen(s);
    for (int i = 0; i < count; i++) {
        res += pow(26, i) * ((int)((s[count - i - 1]) - 'A') + 1);
    }
    return res;
}

int main() {
    char *s = "ABC";
    int res = titleToNumber(s);
    printf("res = %d\n", res);
    return 0;
}